package edu.luc.concordia;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.event.EventListenerList;

/**
 * Copyright 2008 Project Concordia
 * <p>
 * This file is part of RetailReturnSystem.
 * <p>
 * RetailReturnSystem is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * <p>
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * <p>
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.
 * <hr>
 * 
 * @author Rashmi Pandey 
 * @version 2.0 NOV-21-2008
 *  
 * This method creates Report GUI for the retail return system.
 */


public class SystemReports extends JPanel implements ActionListener {
	
	private javax.swing.JButton reportButton;
    private javax.swing.JButton returnButton;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea reportTextArea;
	private JFrame frame;
	
	private EventListenerList listenerList = new EventListenerList();
    
    /** This method is called from within the constructor to
     * initialize the form.
     */
    
    public SystemReports(JFrame frame) {
    	this.frame = frame;
 		this.setLayout(new BorderLayout());
 		JPanel displayPanel = new JPanel();
 		displayPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
 		
        jScrollPane1 = new javax.swing.JScrollPane();
        reportTextArea = new javax.swing.JTextArea();
        reportButton = new javax.swing.JButton();
        returnButton = new javax.swing.JButton();
        setText(DateUtils.now() + "\n----------------------------------- \n" + 
		"\n\n\n THANK YOU !");

        reportTextArea.setColumns(20);
        reportTextArea.setRows(15);
        jScrollPane1.setViewportView(reportTextArea);
        reportButton.setText("Report");
        returnButton.setText("Return");
        
        /**
         * Set all the buttons, TextArea in the Layout.
         */
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(60, 60, 60)
                .addComponent(reportButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 129, Short.MAX_VALUE)
                .addComponent(returnButton)
                .addGap(81, 81, 81))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(79, 79, 79)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE)
                .addGap(99, 99, 99))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 60, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(reportButton)
                    .addComponent(returnButton))
                .addGap(45, 45, 45))
        );
    }     
    
    /**
     * Set the return text area to have the string.
     * @param str
     */
   public void setText(String str)
	{ 		
   	 reportTextArea.setText(str);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		
	}
	
	/**
	 * Add all listener into a list of listeners.
	 * @param l is a action listener from GUI.
	 */
	public void addActionListener(ActionListener l)
	{
		listenerList.add(ActionListener.class, l);
	}
    
}
